package com.resou.reader.reader.animation;

import android.content.Context;
import android.graphics.Canvas;
import android.util.AttributeSet;
import android.view.MotionEvent;

import com.resou.reader.reader.manager.PageFactory;
import com.resou.reader.reader.view.PageView;

/**
 * Created by ${Garrett} on 2018/9/8.
 * Contact me krouky@outlook.com
 */
public abstract class BaseAnimation {

    protected PageFactory pageFactory;

    /**
     * View 执行onMeasure时回调
     *
     * @param width  测量宽度
     * @param height 测量高度
     */
    public abstract void onMeasure(int width, int height);

    /**
     * View执行onDraw时调用
     *
     * @param canvas view的onDraw传过来的画布
     */
    public abstract void onDraw(Canvas canvas);

    /**
     * 当View 接收到touch事件时先把事件给Animation
     *
     * @param event
     * @return
     */
    public abstract boolean onTouchEvent(MotionEvent event);

    public abstract void bindView(PageView pageView);

    public abstract void computeScroll();

    public void setPageFactory(PageFactory pageFactory) {
        this.pageFactory = pageFactory;
    }

    public abstract void onDestory();

    public abstract void refreshCurrPage();

    public abstract void refreshNextPage();

    public abstract void nextPage();

    public abstract void prePage();
}
